<?php
require_once "db.php";
session_start();

$movie = db_escape($_POST['movieid']);
$account = $_SESSION['uid'];
$content = '<div id="comment-box">
				<span>Please write down your comment:</span><textarea rows="5" cols="60">';
$check_comment_query_text = "SELECT comment_content FROM comments WHERE movies_idmovies='$movie' AND accounts_idaccounts='$account'";
$check_comment_query = db_query($check_comment_query_text);
if (mysqli_num_rows($check_comment_query)!=0) {
	$row = mysqli_fetch_assoc($check_comment_query);
	$comment_cont = $row['comment_content'];
	$content .= $comment_cont;
}
$content .= '</textarea>
			<div id="send-comment" data-idmovie="'.$movie.'"><a href="#">Send</a></div>
			<div id="cancel-comment"><a href="#">Cancel</a></div></div>';
echo $content;

